package baiqitun.stupro.project.core.task.impl;

import baiqitun.stupro.common.exception.StuproException;
import baiqitun.stupro.common.exception.enums.support.StuproExceptionEnum;
import baiqitun.stupro.common.workflow.task.AbstractBooleanServiceTaskHandler;
import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.task.api.history.HistoricTaskInstance;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目转让流程
 * 自动化任务处理器
 * @author kedaji
 */
@Service("projectTransferServiceTaskHandler")
public class ProjectTransferServiceTaskHandler extends AbstractBooleanServiceTaskHandler {

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void handleTrue(DelegateExecution execution) {
        HistoricTaskInstance historicTaskInstance = getHistoricTaskInstance(execution);
        String assignee = historicTaskInstance.getAssignee();
        String owner = historicTaskInstance.getOwner();
        String projectId = execution.getProcessInstanceBusinessKey();
        if (projectId == null){
            throw new StuproException(StuproExceptionEnum.ILLEGAL_PARAMETER).put(HistoricTaskInstance.class, "businessKey", null);
        }

    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void handleFalse(DelegateExecution execution) {

    }
}
